Repository navigation
London | 26-ITP-Sept | Fung Nin Lee | Sprint 2 | Implement and rewrite test - #1678
leerogerfn wants to merge 15 commits into
Conversation
…reflex angle. test for reflex angle succeed.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
hackertainment
left a comment
There was a problem hiding this comment.
Thank you for your coursework. Please try to consider increasing test cases coverage to include more possible inputs. Keep it up.
| test("Classifies boundary and invalid angles", () => { | ||
| assert.equal(getAngleType(365), "Invalid angle"); | ||
| assert.equal(getAngleType(-10), "Invalid angle"); | ||
| }); |
There was a problem hiding this comment.
The two cases included here are general cases for invalid angles. There are two boundary cases as well. Can you think of them? If so, please add them as well. Thank you.
| // Case 6: Invalid angles | ||
| test(`should return "Invalid angle" when (angel > 360 || angle < 1)`, () => { | ||
| expect(getAngleType(-10)).toEqual("Invalid angle"); | ||
| expect(getAngleType(365)).toEqual("Invalid angle"); | ||
| }); |
There was a problem hiding this comment.
The two cases included here are general cases for invalid angles. There are two boundary cases as well. Can you think of them? If so, please add them as well. Thank you.
| if (numerator < denominator) { | ||
| return "true"; | ||
| } | ||
| return "false"; |
There was a problem hiding this comment.
According to the provided example test case, the return type should be boolean rather than string. However, I will let you pass this time - because you will learn more about data type in the future, or if you wish, try to book a mentored coding session with a volunteer to clear the concept of data type as early as possible, Thank you.
There was a problem hiding this comment.
how about numerator the same as denominator? how about zero in numerator or denominator? Should they return true or false? Please add them as well. Thank you.
| }); | ||
|
|
||
| test(`should true when denominator and numerator are negative`, () => { | ||
| expect(isProperFraction(-5, -2)).toEqual("true"); |
| ); | ||
| }); | ||
|
|
||
| // TODO: What other invalid card cases can you think of? |
There was a problem hiding this comment.
There should be more test cases for invalid card, how about a card with correct number/face without suit? how about a card with correct suit but no number/face? how about a card missing both number/face and suite? how about a card with suit followed by a number/face? would 11♠ be valid or not? Please add more invalid card cases. Thank you.
| // Invalid Cards | ||
| test(`Expected a number followed by a suit, but got invalid`, () => { | ||
| expect(() => getCardValue("invalid")).toThrow( | ||
| `Expected a number followed by a suit, but got "invalid"` | ||
| ); | ||
| }); |
There was a problem hiding this comment.
Same as my another comment https://github.com/CodeYourFuture/Module-Structuring-and-Testing-Data/pull/1678/changes#r4282076991 , please add more invalid card cases. Thank you.
Learners, PR Template
Self checklist
Task code
CYF-1059
Changelist
Completed writing functions, node test and jest test
Questions
:)